package org.forum.controller;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.forum.domain.Forum;
import org.forum.domain.MainTopic;
import org.forum.domain.User;
import org.forum.service.ForumHomepageService;
import org.forum.utils.JsonUtil;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.opensymphony.xwork2.ActionContext;

/**
 * 1、返回用户关注度最高的3个论坛信息并且对应的返回每个论坛中当天关注度最高的一个话题:返回
 * Json信息包括：信息条数、其他信息内容
 * 
 * @author One
 *
 */
public class ForumHomePageController {
	
	Logger logger = LoggerFactory.getLogger(ForumHomePageController.class);

	//struts注入
	private int forumId;
	
	//spring注入
	private ForumHomepageService forumHomepageService;

	private JsonUtil jsonUtil;
	
	//返回json数据
	private User user;
	
	private MainTopic announcement;

	/**
	 * @pass_Test
	 * 获取论坛管理员信息
	 * 
	 */
	public String administrationInfo(){
		user = forumHomepageService.getAdministrationInfoByForumId(forumId);
		return "administrationInfo";
	}
	
	
	/**
	 * @pass_Test
	 * 根据论坛id获取论坛公告信息（仅显示一条）
	 */
	public String announcementInfo(){
		announcement = forumHomepageService.getAnnouncementInfoByForumId(forumId);
		return "announcement";
	}
	
	/**
	 * 
	 * @return
	 */
	public List<MainTopic> mainTopics(){
		
		return null;
	}

	public void setForumId(int forumId) {
		this.forumId = forumId;
	}

	public void setForumHomepageService(ForumHomepageService forumHomepageService) {
		this.forumHomepageService = forumHomepageService;
	}

	public void setJsonUtil(JsonUtil jsonUtil) {
		this.jsonUtil = jsonUtil;
	}

	//
	public User getUser() {
		return user;
	}

	public MainTopic getAnnouncement() {
		return announcement;
	}

}
